package com.library.servlet.admin;

import com.library.dao.BorrowRecordDAO;
import com.library.entity.BorrowRecord;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/borrowRecords")
public class BorrowRecordServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        BorrowRecordDAO recordDAO = new BorrowRecordDAO();
        List<BorrowRecord> records = recordDAO.getAllBorrowRecords();
        request.setAttribute("records", records);
        request.getRequestDispatcher("/admin/borrowRecordList.jsp").forward(request, response);
    }
}    